//
//  OL_View.m
//  YUXiu
//
//  Created by 王竞成 on 16/6/24.
//  Copyright © 2016年 Wang. All rights reserved.
//

#import "OL_View.h"
#import "courseModel.h"

@implementation OL_View


- (id)initWithFrame:(CGRect)frame model:(courseModel*)model{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor lightGrayColor];
        [self initView:model];
    }
    return self;
}
//视图加载,暂定self的Size(180,120)
- (void)initView:(courseModel *)model{
    self.layer.cornerRadius = 10;
    [self.layer setMasksToBounds:YES];
    
  //课程图片
    self.imgView = [[UIImageView alloc]initWithFrame:self.frame];
    [self.imgView sd_setImageWithURL:[NSURL URLWithString:@"http://www..."] placeholderImage:[UIImage imageNamed:@""]];
    [self.imgView.layer setMasksToBounds:YES];
    [self.imgView.layer setCornerRadius:5];
    
    [self addSubview:self.imgView];
    
    //
    self.courseL = [[UILabel alloc]initWithFrame:krect(self.width-10-50, 10, 50, 20)];
    self.courseL.text = model.courseStr;
    self.courseL.textColor = kWhiteCOLOR;
    self.courseL.backgroundColor = kGrayCOLOR;
    self.courseL.layer.cornerRadius = 3;
    [self.courseL.layer setMasksToBounds:YES];
    self.courseL.textAlignment = NSTextAlignmentCenter;
    [self addSubview:_courseL];
    
    //
    self.titleL = [[UILabel alloc]initWithFrame:krect(10, self.golf_height-30, self.golf_width-80, 25)];
    self.titleL.text = model.titleStr;
    self.titleL.textColor = kWhiteCOLOR;
    self.titleL.font = Font(12);
    self.titleL.textAlignment = NSTextAlignmentLeft;
    [self addSubview:_titleL];
    
    //
    self.fanL = [[UILabel alloc]initWithFrame:krect(_titleL.golf_right, self.golf_height-30, 70, 25)];
    self.fanL.textAlignment = NSTextAlignmentRight;
    self.fanL.text = model.fanStr;
    self.fanL.font = Font(12);

    self.fanL.textColor = kWhiteCOLOR;
    [self addSubview:_fanL];
    

}
@end
